<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 1. 具名函数
    function fn1() {
      console.log('具名函数')
    }

    fn1()

    // 2. 匿名函数
    let fn2 = function () {
      console.log('匿名函数')
    }

    fn2()

    // 3. 箭头函数
    let fn3 = () => {
      console.log('箭头函数')
    }

    fn3()

    // 参数传递
    function printInfo(name, gender = 'man', ...args) {
      console.log(name)
      console.log(gender)
      console.log(args)
    }

    printInfo('小红', 'woman', 1, 2, 3)  // 小红 woman [1, 2, 3]
    printInfo('小红', 1, 2, 3)  // 小红 1 [2, 3]
  </script>
</body>

</html>